<?php


/**
 * Base class that represents a query for the 'voorspelling' table.
 *
 * 
 *
 * @method     VoorspellingQuery orderByVoorspellingid($order = Criteria::ASC) Order by the voorspellingID column
 * @method     VoorspellingQuery orderByWedstrijdid($order = Criteria::ASC) Order by the wedstrijdID column
 * @method     VoorspellingQuery orderByGebruikerid($order = Criteria::ASC) Order by the gebruikerID column
 * @method     VoorspellingQuery orderByPoulid($order = Criteria::ASC) Order by the poulID column
 * @method     VoorspellingQuery orderByPuntenthuis($order = Criteria::ASC) Order by the puntenthuis column
 * @method     VoorspellingQuery orderByPuntenuit($order = Criteria::ASC) Order by the puntenuit column
 *
 * @method     VoorspellingQuery groupByVoorspellingid() Group by the voorspellingID column
 * @method     VoorspellingQuery groupByWedstrijdid() Group by the wedstrijdID column
 * @method     VoorspellingQuery groupByGebruikerid() Group by the gebruikerID column
 * @method     VoorspellingQuery groupByPoulid() Group by the poulID column
 * @method     VoorspellingQuery groupByPuntenthuis() Group by the puntenthuis column
 * @method     VoorspellingQuery groupByPuntenuit() Group by the puntenuit column
 *
 * @method     VoorspellingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method     VoorspellingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method     VoorspellingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method     VoorspellingQuery leftJoinWedstrijd($relationAlias = null) Adds a LEFT JOIN clause to the query using the Wedstrijd relation
 * @method     VoorspellingQuery rightJoinWedstrijd($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Wedstrijd relation
 * @method     VoorspellingQuery innerJoinWedstrijd($relationAlias = null) Adds a INNER JOIN clause to the query using the Wedstrijd relation
 *
 * @method     VoorspellingQuery leftJoinGebruiker($relationAlias = null) Adds a LEFT JOIN clause to the query using the Gebruiker relation
 * @method     VoorspellingQuery rightJoinGebruiker($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Gebruiker relation
 * @method     VoorspellingQuery innerJoinGebruiker($relationAlias = null) Adds a INNER JOIN clause to the query using the Gebruiker relation
 *
 * @method     VoorspellingQuery leftJoinPoul($relationAlias = null) Adds a LEFT JOIN clause to the query using the Poul relation
 * @method     VoorspellingQuery rightJoinPoul($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Poul relation
 * @method     VoorspellingQuery innerJoinPoul($relationAlias = null) Adds a INNER JOIN clause to the query using the Poul relation
 *
 * @method     Voorspelling findOne(PropelPDO $con = null) Return the first Voorspelling matching the query
 * @method     Voorspelling findOneOrCreate(PropelPDO $con = null) Return the first Voorspelling matching the query, or a new Voorspelling object populated from the query conditions when no match is found
 *
 * @method     Voorspelling findOneByVoorspellingid(int $voorspellingID) Return the first Voorspelling filtered by the voorspellingID column
 * @method     Voorspelling findOneByWedstrijdid(int $wedstrijdID) Return the first Voorspelling filtered by the wedstrijdID column
 * @method     Voorspelling findOneByGebruikerid(int $gebruikerID) Return the first Voorspelling filtered by the gebruikerID column
 * @method     Voorspelling findOneByPoulid(int $poulID) Return the first Voorspelling filtered by the poulID column
 * @method     Voorspelling findOneByPuntenthuis(int $puntenthuis) Return the first Voorspelling filtered by the puntenthuis column
 * @method     Voorspelling findOneByPuntenuit(int $puntenuit) Return the first Voorspelling filtered by the puntenuit column
 *
 * @method     array findByVoorspellingid(int $voorspellingID) Return Voorspelling objects filtered by the voorspellingID column
 * @method     array findByWedstrijdid(int $wedstrijdID) Return Voorspelling objects filtered by the wedstrijdID column
 * @method     array findByGebruikerid(int $gebruikerID) Return Voorspelling objects filtered by the gebruikerID column
 * @method     array findByPoulid(int $poulID) Return Voorspelling objects filtered by the poulID column
 * @method     array findByPuntenthuis(int $puntenthuis) Return Voorspelling objects filtered by the puntenthuis column
 * @method     array findByPuntenuit(int $puntenuit) Return Voorspelling objects filtered by the puntenuit column
 *
 * @package    propel.generator.database.om
 */
abstract class BaseVoorspellingQuery extends ModelCriteria
{

	/**
	 * Initializes internal state of BaseVoorspellingQuery object.
	 *
	 * @param     string $dbName The dabase name
	 * @param     string $modelName The phpName of a model, e.g. 'Book'
	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
	 */
	public function __construct($dbName = 'database', $modelName = 'Voorspelling', $modelAlias = null)
	{
		parent::__construct($dbName, $modelName, $modelAlias);
	}

	/**
	 * Returns a new VoorspellingQuery object.
	 *
	 * @param     string $modelAlias The alias of a model in the query
	 * @param     Criteria $criteria Optional Criteria to build the query from
	 *
	 * @return    VoorspellingQuery
	 */
	public static function create($modelAlias = null, $criteria = null)
	{
		if ($criteria instanceof VoorspellingQuery) {
			return $criteria;
		}
		$query = new VoorspellingQuery();
		if (null !== $modelAlias) {
			$query->setModelAlias($modelAlias);
		}
		if ($criteria instanceof Criteria) {
			$query->mergeWith($criteria);
		}
		return $query;
	}

	/**
	 * Find object by primary key
	 * Use instance pooling to avoid a database query if the object exists
	 * <code>
	 * $obj  = $c->findPk(12, $con);
	 * </code>
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    Voorspelling|array|mixed the result, formatted by the current formatter
	 */
	public function findPk($key, $con = null)
	{
		if ((null !== ($obj = VoorspellingPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
			// the object is alredy in the instance pool
			return $obj;
		} else {
			// the object has not been requested yet, or the formatter is not an object formatter
			$criteria = $this->isKeepQuery() ? clone $this : $this;
			$stmt = $criteria
				->filterByPrimaryKey($key)
				->getSelectStatement($con);
			return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
		}
	}

	/**
	 * Find objects by primary key
	 * <code>
	 * $objs = $c->findPks(array(12, 56, 832), $con);
	 * </code>
	 * @param     array $keys Primary keys to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
	 */
	public function findPks($keys, $con = null)
	{	
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		return $this
			->filterByPrimaryKeys($keys)
			->find($con);
	}

	/**
	 * Filter the query by primary key
	 *
	 * @param     mixed $key Primary key to use for the query
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKey($key)
	{
		return $this->addUsingAlias(VoorspellingPeer::VOORSPELLINGID, $key, Criteria::EQUAL);
	}

	/**
	 * Filter the query by a list of primary keys
	 *
	 * @param     array $keys The list of primary key to use for the query
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKeys($keys)
	{
		return $this->addUsingAlias(VoorspellingPeer::VOORSPELLINGID, $keys, Criteria::IN);
	}

	/**
	 * Filter the query on the voorspellingID column
	 * 
	 * @param     int|array $voorspellingid The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByVoorspellingid($voorspellingid = null, $comparison = null)
	{
		if (is_array($voorspellingid) && null === $comparison) {
			$comparison = Criteria::IN;
		}
		return $this->addUsingAlias(VoorspellingPeer::VOORSPELLINGID, $voorspellingid, $comparison);
	}

	/**
	 * Filter the query on the wedstrijdID column
	 * 
	 * @param     int|array $wedstrijdid The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByWedstrijdid($wedstrijdid = null, $comparison = null)
	{
		if (is_array($wedstrijdid)) {
			$useMinMax = false;
			if (isset($wedstrijdid['min'])) {
				$this->addUsingAlias(VoorspellingPeer::WEDSTRIJDID, $wedstrijdid['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($wedstrijdid['max'])) {
				$this->addUsingAlias(VoorspellingPeer::WEDSTRIJDID, $wedstrijdid['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(VoorspellingPeer::WEDSTRIJDID, $wedstrijdid, $comparison);
	}

	/**
	 * Filter the query on the gebruikerID column
	 * 
	 * @param     int|array $gebruikerid The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByGebruikerid($gebruikerid = null, $comparison = null)
	{
		if (is_array($gebruikerid)) {
			$useMinMax = false;
			if (isset($gebruikerid['min'])) {
				$this->addUsingAlias(VoorspellingPeer::GEBRUIKERID, $gebruikerid['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($gebruikerid['max'])) {
				$this->addUsingAlias(VoorspellingPeer::GEBRUIKERID, $gebruikerid['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(VoorspellingPeer::GEBRUIKERID, $gebruikerid, $comparison);
	}

	/**
	 * Filter the query on the poulID column
	 * 
	 * @param     int|array $poulid The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByPoulid($poulid = null, $comparison = null)
	{
		if (is_array($poulid)) {
			$useMinMax = false;
			if (isset($poulid['min'])) {
				$this->addUsingAlias(VoorspellingPeer::POULID, $poulid['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($poulid['max'])) {
				$this->addUsingAlias(VoorspellingPeer::POULID, $poulid['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(VoorspellingPeer::POULID, $poulid, $comparison);
	}

	/**
	 * Filter the query on the puntenthuis column
	 * 
	 * @param     int|array $puntenthuis The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByPuntenthuis($puntenthuis = null, $comparison = null)
	{
		if (is_array($puntenthuis)) {
			$useMinMax = false;
			if (isset($puntenthuis['min'])) {
				$this->addUsingAlias(VoorspellingPeer::PUNTENTHUIS, $puntenthuis['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($puntenthuis['max'])) {
				$this->addUsingAlias(VoorspellingPeer::PUNTENTHUIS, $puntenthuis['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(VoorspellingPeer::PUNTENTHUIS, $puntenthuis, $comparison);
	}

	/**
	 * Filter the query on the puntenuit column
	 * 
	 * @param     int|array $puntenuit The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByPuntenuit($puntenuit = null, $comparison = null)
	{
		if (is_array($puntenuit)) {
			$useMinMax = false;
			if (isset($puntenuit['min'])) {
				$this->addUsingAlias(VoorspellingPeer::PUNTENUIT, $puntenuit['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($puntenuit['max'])) {
				$this->addUsingAlias(VoorspellingPeer::PUNTENUIT, $puntenuit['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(VoorspellingPeer::PUNTENUIT, $puntenuit, $comparison);
	}

	/**
	 * Filter the query by a related Wedstrijd object
	 *
	 * @param     Wedstrijd $wedstrijd  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByWedstrijd($wedstrijd, $comparison = null)
	{
		return $this
			->addUsingAlias(VoorspellingPeer::WEDSTRIJDID, $wedstrijd->getWedstrijdid(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the Wedstrijd relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function joinWedstrijd($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Wedstrijd');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Wedstrijd');
		}
		
		return $this;
	}

	/**
	 * Use the Wedstrijd relation Wedstrijd object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    WedstrijdQuery A secondary query class using the current class as primary query
	 */
	public function useWedstrijdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinWedstrijd($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Wedstrijd', 'WedstrijdQuery');
	}

	/**
	 * Filter the query by a related Gebruiker object
	 *
	 * @param     Gebruiker $gebruiker  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByGebruiker($gebruiker, $comparison = null)
	{
		return $this
			->addUsingAlias(VoorspellingPeer::GEBRUIKERID, $gebruiker->getGebruikerid(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the Gebruiker relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function joinGebruiker($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Gebruiker');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Gebruiker');
		}
		
		return $this;
	}

	/**
	 * Use the Gebruiker relation Gebruiker object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    GebruikerQuery A secondary query class using the current class as primary query
	 */
	public function useGebruikerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinGebruiker($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Gebruiker', 'GebruikerQuery');
	}

	/**
	 * Filter the query by a related Poul object
	 *
	 * @param     Poul $poul  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function filterByPoul($poul, $comparison = null)
	{
		return $this
			->addUsingAlias(VoorspellingPeer::POULID, $poul->getPoulid(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the Poul relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function joinPoul($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Poul');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Poul');
		}
		
		return $this;
	}

	/**
	 * Use the Poul relation Poul object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    PoulQuery A secondary query class using the current class as primary query
	 */
	public function usePoulQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinPoul($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Poul', 'PoulQuery');
	}

	/**
	 * Exclude object from result
	 *
	 * @param     Voorspelling $voorspelling Object to remove from the list of results
	 *
	 * @return    VoorspellingQuery The current query, for fluid interface
	 */
	public function prune($voorspelling = null)
	{
		if ($voorspelling) {
			$this->addUsingAlias(VoorspellingPeer::VOORSPELLINGID, $voorspelling->getVoorspellingid(), Criteria::NOT_EQUAL);
	  }
	  
		return $this;
	}

} // BaseVoorspellingQuery
